package com.xyd.Service;

import com.xyd.bean.Comment;
import com.xyd.dao.CommentMapper;
import com.xyd.util.SqlSessionFactoryUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class CommentService {
    SqlSession sqlSession = SqlSessionFactoryUtil.getSqlSession();
    CommentMapper commentMapper = sqlSession.getMapper(CommentMapper.class);

    public int addComment(Comment comment){
        return commentMapper.insertAll(comment);
    }
    public List<Comment> getAll(){
        return commentMapper.getAll();
    }
    public Comment getByid(int id){
        return commentMapper.getById(id);
    }
    public int modifyComment(Comment comment){
        return commentMapper.updateByid(comment);
    }
    public int delComment(int id){
        return commentMapper.delById(id);
    }

}
